/*    */ package com.chb.weblog.test;
/*    */ 
/*    */ import java.io.BufferedReader;
/*    */ import java.io.FileReader;
/*    */ import java.io.IOException;
/*    */ import java.io.PrintStream;
/*    */ import java.text.SimpleDateFormat;
/*    */ import java.util.Date;
/*    */ import java.util.List;
/*    */ import java.util.Locale;
/*    */ 
/*    */ public class View
/*    */ {
/*    */   public static void main(String[] args)
/*    */   {
/* 27 */     AccessLog accessLogs = new AccessLog();
/*    */ 
/* 29 */     SimpleDateFormat sdf = new SimpleDateFormat("[dd/MM/yyyy:HH:mm:ss ", Locale.ENGLISH);
/* 30 */     BufferedReader br = null;
/*    */     try
/*    */     {
/* 33 */       br = new BufferedReader(new FileReader("c://data.txt"));
/* 34 */       String line = null;
/*    */       Date date;
/* 35 */       while ((line = br.readLine()) != null) {
/* 36 */         String[] arr = line.split(" - - ");
/* 37 */         date = sdf.parse(arr[1]);
/* 38 */         accessLogs.put(date);
/*    */       }
/*    */ 
/* 41 */       for (List accessLog : accessLogs.getAccessLogs()) {
/* 42 */         Date startTime = (Date)accessLog.get(0);
/* 43 */         Date endTime = (Date)accessLog.get(accessLog.size());
/* 44 */         System.out.println("起始时间：" + startTime + "\t" + "访问时长：" + (endTime.getTime() - startTime.getTime()));
/*    */       }
/*    */     } catch (Exception e) {
/* 47 */       e.printStackTrace();
/*    */ 
/* 49 */       if (br != null)
/*    */         try {
/* 51 */           br.close();
/*    */         } catch (IOException e1) {
/* 53 */           e1.printStackTrace();
/*    */         }
/*    */     }
/*    */     finally
/*    */     {
/* 49 */       if (br != null)
/*    */         try {
/* 51 */           br.close();
/*    */         } catch (IOException e) {
/* 53 */           e.printStackTrace();
/*    */         }
/*    */     }
/*    */   }
/*    */ }

/* Location:           H:\我的资料\Hadoop学习\hive\Hive视频教程\资料\day4\项目代码\step-3-运行预处理\weblog.jar
 * Qualified Name:     cn.itcast.bigdate.test.View
 * JD-Core Version:    0.6.2
 */